<template>
    <i-table :columns="columns1" :data="data">
    </i-table>
</template>
<script>
    module.exports = {
        props: {
            columns: Array,
            data: Array
        },
        data(){
            columns1:[]
        },
        computed: {
            columns1() {
                let c = []
                c.push({
                    title: '#',
                    type: 'expand',
                    render: (h, params) => {
                        if (params.row.children) {
                            return h('itable-body', {
                                props: {
                                    columns: this.columns,
                                    data: params.row.children
                                },on: {
                                    click: () => {
                                        console.info("itable click ",params.row);
                                    }
                                }
                            });
                        } else {
                            return h('');
                        }

                    }
                })
              if(this.columns){
                  this.columns.forEach(col => {
                      c.push(col)
                      // console.log(c);
                  })
              }

                console.log(c);
                return c
            }
        }
    }
</script>
